/*
 *Create By：Z.B
 *@DATE 2019/3/18 10:08
 *@EMAIL: 2545375@qq.com
 */
'use strict';

const moment = require('moment');

exports.formatTime = time => moment(time).format("yyyy-MM-dd hh:mm:ss");

exports.success = ({ctx,res=null,msg='请求成功'}) => {
  ctx.body = {
    code: 0,
    data: res,
    msg
  };
  ctx.status = 200;
};

exports.error = ({ctx,res=null,msg='请求失败',code=500}) => {
  ctx.body = {
    code,
    data:res,
    msg
  }
  ctx.status = 500;
};